package org.meetunexpectedly.holder;

/**
 * @Description: 用户共享变量缓存
 * @Author: pupil
 * @Date: 2024/08/11 下午 7:05
 */
public class UserHolder {

    private static ThreadLocal<Long> userThreadLocal = new ThreadLocal<>();

    // 添加
    public static void set(Object id){
        userThreadLocal.set(Long.valueOf(id.toString()));
    }

    // 获取
    public static Long get(){
        return userThreadLocal.get();
    }

    // 删除
    public static void clear(){
        userThreadLocal.remove();
    }
}
